/*
http://www.nowcoder.com/practice/e8a1b01a2df14cb2b228b30ee6a92163
*/

#include<helper.h>
  int MoreThanHalfNum_Solution(vector<int> numbers) {
      int i,v=-222,c=0,n=numbers.size();
      for (i=0;i<n;i++){
          if (numbers[i]!=v){
              c--;
              if (c<=0) {v=numbers[i];c=1;}
          }else{
              c++;
          }
      }
      for (c=0,i=0;i<n;i++) c+=numbers[i]==v;

      return  2*c>n?v:0; 
    
    }

int  main(){
    return 0;
}